package cn.zlb.frame.infrastructure.util.gateway.pay;

import cn.zlb.frame.domain.pay.model.entity.PaymentEntity;
import cn.zlb.frame.domain.pay.respository.gateway.IPayGateway;
import cn.zlb.frame.infrastructure.util.mysql.PaymentMapper;
import javax.annotation.Resource;
import org.springframework.boot.SpringApplication;
import org.springframework.stereotype.Service;

/**
 * @author yangjie.deng@resico.cn
 * @date 2023-11-09 15:55:03
 * @describe class responsibility
 */
@Service
public class PayGateway implements IPayGateway {

    @Resource
    PaymentMapper paymentMapper;

    @Override
    public void callPay(PaymentEntity paymentEntity) {
        // todo 此处根据支付类型不同 调用不同第三方支付
//        SpringApplication.getBeanOfType(IPayStrategy.class)
//                .values()
//                        .stream().filter(t -> t.getPayType() == paymentEntity.getPayType())
//                .findAny().get();
        // 调用结果更新到payment中
        paymentMapper.update(null, null);
    }
}
